/*!
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

.ouiDatePopoverButton {
  @include ouiSuperDatePickerText;
  background-size: 100%; // For the bottom "border" via background-image

  &:focus,
  &-isSelected {
    background-image: ouiFormControlGradient();
  }

  &-needsUpdating {
    $backgroundColor: tintOrShade($ouiColorSuccess, 90%, 70%);
    $textColor: makeHighContrastColor($ouiColorSuccess, $backgroundColor);

    background-color: $backgroundColor;
    color: $textColor;

    &:focus,
    &.ouiDatePopoverButton-isSelected {
      background-image: ouiFormControlGradient($ouiColorSuccess);
    }
  }

  &-isInvalid {
    $backgroundColor: tintOrShade($ouiColorDanger, 90%, 70%);
    $textColor: makeHighContrastColor($ouiColorDanger, $backgroundColor);

    background-color: $backgroundColor;
    color: $textColor;

    &:focus,
    &.ouiDatePopoverButton-isSelected {
      background-image: ouiFormControlGradient($ouiColorDanger);
    }
  }

  &:disabled {
    background-color: $ouiFormBackgroundDisabledColor;
    color: $ouiColorDarkShade;
    cursor: default;
  }

  &-compressed {
    line-height: $ouiFormControlLayoutGroupInputCompressedHeight;
    height: $ouiFormControlLayoutGroupInputCompressedHeight;
  }
}

.ouiDatePopoverButton--start {
  text-align: right;
}

.ouiDatePopoverButton--end {
  text-align: left;
}
